package com.migu.rbac.util;

/**
 * 生成数机五位数
 */
public class RandomUtils {

    private RandomUtils(){}

    public static String getFiveRandomNum(){
        int i=(int)(Math.random()*90000)+10000;
        return String.valueOf(i);
    }

    /**
     * @param cnt
     * 功能描述 ：得到一个cnt位的随机
     */
    public static String getRandomNumber(int cnt) {
        int j = cnt;
        long[] random = new long[j];
        for (int i = 0; i < j; i++)
        {
            random[i] = Math.round(Math.floor((Math.random() * 10)));
        }
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < random.length; i++)
        {
            String temp = Long.toString(random[i]);
            sb.append(temp);
        }
        return sb.toString();
    }

}
